const {createApp} = Vue;
const app = createApp({
	data() {
		return{
			goods
		}
	},
	methods:{
		increse(index){
			this.goodsList[index].chooseNum++;
		},
		decrese(val){
			if(val.chooseNum <= 0){
				return
			}
			val.chooseNum--;
			val.allPrice = val.chooseNum * val.price;
		},
		topJump(el){
			this.addIconInfo.show = true
			//设置起始位置
			const startRect = el.target/getBoundingClientRect();
			this.addIconInfo.point.x = startRect.x + startRect.width/2;
			this.addIconInfo.point.y = startRect.y + startRect.height/2;
			setTimeout(() => {
				const endRect = this.$refs.footerCar.getBoundingClientRect();
				this.addIconInfo.point.x = endRect.x + endRect.width/2;
				this.addIconInfo.point.y = endRect.y + endRect.height/2;
			},0)
		}
	},
	computed:{
		goodsList(){
			let sumPrice = 0;
			let goodsNum = 0;
			return this.goods.map(val => {
				return {
					..val,
					chooseNum:0
				}
			})
		}
	}
})
const vm = app.mount('#app')